{include file="index/header" /}
<block name="css">
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/UEditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/UEditor/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/UEditor/lang/zh-cn/zh-cn.js"></script>
</block>
<body>
    <div class="panel admin-panel margin-top" id="add">
        <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 增加内容</strong></div>
        <div class="body-content">
            <form method="post" class="form-x" action="">    
                <div class="form-group">
                    <div class="label">
                        <label>名称：</label>
                    </div>
                    <div class="field">
                        <input type="text" class="input w50" value="" name="t_name" data-validate="required:请输入标题" />
                        <div class="tips"></div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label>分类标题：</label>
                    </div>
                    <div class="field">
                        <select name="nav_id" class="input w50" id="nav" data-validate="required:请选择教程">
                            <option value="">请选择教程</option>
                            {foreach name='nav_data' item='nav'}
                            <option value="{$nav.nav_id}">{$nav.nav_name}</option>
                            {/foreach}
                        </select>  
                        <select name="type_id" class="input w50" id="type" data-validate="required:请选择阶段">
                            <option value="">请选择阶段</option>
                            {foreach name='type_data' item='type'}
                            <option value="{$type.type_id}">{$type.type_name}</option>
                            {/foreach}
                        </select>
                        <select name="s_id" class="input w50" id="s" data-validate="required:请选择章节">
                            <option value="">请选择章节</option>
                            {foreach name='s_data' item='s'}
                            <option value="{$s.s_id}">{$s.s_name}</option>
                            {/foreach}
                        </select>
                        <div class="tips"></div>
                    </div>
                </div>
                 <div class="form-group">
                    <div class="label">
                        <label>是否是资料下载：</label>
                    </div>
                    <div class="field">
                        <div class="button-group radio">
                            <label class="button active">
                                <span class="icon icon-check"></span>
                                <input name="is_infor" value="1" type="radio">是
                            </label>
                            <label class="button">
                                <span class="icon icon-times"></span>
                                <input name="is_infor" value="0"  type="radio"  checked="checked">否
                            </label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label>内容：</label>
                    </div>
                    <div class="field">
                        <textarea name="t_content" id="editor" style="width:845px; height:460px;"></textarea>
                        <div class="tips">一句话介绍本章节</div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label></label>
                    </div>
                    <div class="field">
                        <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</body></html>
<script>
    $('#nav').change(function(){
        var nav_id = $(this).val();
        $("#type option:gt(0)").remove();
        if(nav_id == ''){
            return;
        }
        $.ajax({
            type:'GET',
            url :"{:url('getType')}",
            data:'nav_id='+nav_id,
            dataType:'json',
            success : function(data){
                $.each(data, function(k,v){
                    $('#type').append('<option value="'+v.type_id+'">'+v.type_name+'</option>');
                });
            }
        });
    });
    $('#type').change(function(){
        var type_id = $(this).val();
        $("#s option:gt(0)").remove();
        if(type_id == ''){
            return;
        }
        $.ajax({
            type:'GET',
            url :"{:url('course/getS')}",
            data:'type_id='+type_id,
            dataType:'json',
            success : function(data){
                $.each(data.s_data, function(k,v){
                    $('#s').append('<option value="'+v.s_id+'">'+v.s_name+'</option>');
                });
            }
        });
    });
</script>
<script type="text/javascript">

    var ue = UE.getEditor('editor');
</script>